package com.zhiyun.service.impl;

import com.zhiyun.domain.Notice;
import com.zhiyun.mapper.NoticeMapper;
import com.zhiyun.service.NoticeService;
import com.zhiyun.util.Db;
import com.zhiyun.vo.Result;

import java.util.List;

/**
 * @author zc
 * @Date 2025/4/29 下午3:55
 */
public class NoticeServiceImpl implements NoticeService {
    NoticeMapper noticeMapper = Db.getMapper(NoticeMapper.class);
    @Override
    public Result findByCourseId(int courseId) {
        List<Notice> list = noticeMapper.findByCourseId(courseId);
        return Result.ok(list);
    }
    @Override
    public Result insertNotice(Notice notice) {
        int rows = noticeMapper.insert(notice);
        if (rows > 0) {
            return Result.okMsg("发布成功");
        }
        return Result.fail("发布失败");
    }
}
